import ajax from '../service/ajax.js'


export default{
    namespaced:true,
    state:{
        userList:{},
        userParam:{pageNo:'1',pageSize:'',userGrade:''},
        logList:{},
        logParam:{pageNo:'1',pageSize:'',startTime:'',endTime:''}
    },
    mutations:{
        setUserList(state,user){
            state.userList = user
        },
        setUserParam(state,user){
            state.userParam = user
        },
        setLogList(state,log){
            state.logList = log
        },
        setLogParam(stat,log){
            stat.logParam = log
        }

    },
    actions:{
        async findAllUser(context){
            let userInfo = await ajax.getSubmit("/api/user/findAllUser",context.state.userParam)
            context.commit("setUserList",userInfo)
        },
        async findGrade(context){
            let userInfo = await ajax.getSubmit("/api/user/findGrade",context.state.userParam)
            context.commit("setUserList",userInfo)
        },
        async findAllLog(context){
            let logInfo = await ajax.getSubmit("/api/log/findAllLog",context.state.logParam)
            context.commit("setLogList",logInfo)
        },
        async findTime(context){
            let logInfo = await ajax.getSubmit("/api/log/findTime",context.state.logParam)
            context.commit("setLogList",logInfo)
        }
    }
}